require(
    [
        '../lib/gojs/go-debug'
    ],
    function (go) {

        var $$ = go.GraphObject.make;

        var diagram =
            $$(go.Diagram, "main",
                { initialContentAlignment: go.Spot.Center });


        diagram.nodeTemplate =
            $$(go.Node, "Auto",
                new go.Binding("location", "loc", go.Point.parse),
                new go.Binding("resizable", "resizable"),
                new go.Binding("movable", "movable"),
                $$(go.Shape, "RoundedRectangle",
                    { // default values if the data.highlight is undefined:
                        fill: "yellow", stroke: "orange", strokeWidth: 2 },
                    new go.Binding("fill", "highlight", function(v) { return v ? "pink" : "lightblue"; }),
                    new go.Binding("stroke", "highlight", function(v) { return v ? "red" : "blue"; }),
                    new go.Binding("strokeWidth", "highlight", function(v) { return v ? 3 : 1; })),
                $$(go.TextBlock,
                    { margin: 5 },
                    new go.Binding("text", "deviceNo"),
                    new go.Binding("editable", "editable")
                )
            );

        var nodeDataArray = [
            { deviceNo: "Alpha2", loc: "0 50", highlight: false,editable:true},
            { deviceNo: "Beta", loc: "100 50", highlight: true,movable:false },
            { deviceNo: "Gamma", loc: "0 100" ,resizable:true}  // highlight property undefined: use defaults
        ];

        diagram.model = new go.Model(nodeDataArray);
    }
)